﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;  

public partial class Players_delete : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            okmsg.Style["display"] = "none";
            badmsg.Style["display"] = "none";
            if (Request.QueryString["delete"] != null) { 
                //Borramos usuario
                Boolean Result = Player.DeletePlayer(Int32.Parse(Request.QueryString["delete"]));
                if (Result == true)
                {
                    okmsg.Style["display"] = "block";
                }
                else {
                    badmsg.Style["display"] = "block";
                }
            }   

            AjaxPro.Utility.RegisterTypeForAjax(typeof(Players_delete));
            sel_Players.DataSource = Player.GetAllPlayers();
            sel_Players.DataTextField = "Player_Number";
            sel_Players.DataValueField = "Pk_Player";
            sel_Players.DataBind();
            sel_Players.Items.Insert(0, "Select...");
            sel_Players.Items[0].Value = "-1";
        }
        catch{ 
        
        
        }
    }
    [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)]
    public Player LoadPlayerData(int p_Pk_Player)
    {
        try
        {

            Player oPlayer = new Player(p_Pk_Player);
            return oPlayer; 
              

             
        }
        catch
        {
            return null;
        }
    }
}
